 <style>
.ttl{width:80px;text-align:right;display-inline:block;}
.pop_cont_input{line-height:30px;} .pop_cont_input input{pading:0px 5px;} .pop_cont_input select{height:28px;}

.pop_cont ul li{width:380px;float:left;}
 </style>
 <div class="pop_cont" style="width:820px;left:30%;">
 <input type="hidden" value="<?php echo $id; ?>" id="editId" />
       <!--title-->
       <h3><?php echo $title;?></h3>
       <!--content-->
       <div class="pop_cont_input">
        <ul>
           <li>
          <span class="ttl">设备分类</span>
          
       
        <select name="e-first_type" id="e-first_type" class="select firstTypeRS">
	       <option value="">--一级分类--</option>
	       <?php
	       
	       foreach($FirstDepList as $key=>$val)
	   		{
	   		?>
	        <option value="<?php echo $val['id']; ?>"><?php echo $val['dname'] ?></option>
		   <?php
	       }
       		?>
          </select>
          <select name="e-type" id="e-type" class="select secondTypeRS">
	       <option value="">--二级分类--</option>
	       <?php
	       foreach($SecondDepList as $key=>$val)
	   		{
	   		?>
	        <option value="<?php echo $val['id']; ?>"><?php echo $val['dname'] ?></option>
		   <?php
	       }
       		?>
          </select>
          
         </li>
         
               
         <li>
          <span class="ttl">名称</span>
          <input type="text" name="e-dvename" id="e-dvename" value="" placeholder="资产名称" class="textbox" style="padding:0px;" />
         </li>
       
       
        
        <li>
          <span class="ttl">编号</span>
          <input type="text" name="e-dveid" id="e-dveid" value="" placeholder="" class="textbox" style="padding:0px;" />
       <!--     自动 <input type="checkbox" name="autoDve" checked=true id="autoDve"  value="1" />-->
         </li>
         
        
        
        
        
        
        
       <li>
          <span class="ttl">品牌</span>
          <input type="text" name="e-brand" id="e-brand" value="" placeholder="资产名称" class="textbox" style="padding:0px;" />
         </li>
       
       
        <li>
          <span class="ttl">序列号</span>
          <input type="text" name="e-sn" id="e-sn" value="" placeholder="设备生产序列号" class="textbox" style="padding:0px;" />
         </li>
         
         
         <li>
          <span class="ttl">型号</span>
          <input type="text" name="e-model" id="e-model" value="" placeholder="型号" class="textbox" style="padding:0px;" />
         </li>
         
         
         <li>
          <span class="ttl">位置</span>
          <input type="text" name="e-addr" id="e-addr" value="" placeholder="设备位置" class="textbox" style="padding:0px;" />
         </li>
         
         
          <li>
          <span class="ttl">价值</span>
          <input type="text" name="e-price" id="e-price" value="0.00" placeholder="设备价值" class="textbox" style="padding:0px;" />
         </li>
         
         
        
         
          <li>
          <span class="ttl">数量</span>
           <input type="text" name="e-amount" id="e-amount" value="1" placeholder="设备数量" class="textbox" style="padding:0px;" />
          
         </li>
         
         <li>
          <span class="ttl">单位</span>
          <input type="text" name="e-unit" id="e-unit" value="件" placeholder="单位，件、个、台、张" class="textbox" style="padding:0px;" />
         </li>
         
          <li>
          <span class="ttl">属性</span>
          <select name="e-network" id="e-network" >
              <option value="0" >普通资产</option>
              <option value="1">网络设备</option>
          </select>
          
         </li>
        
         
         <li class="network_type">
          <span class="ttl">IP</span>
          <input type="text" name="e-ip" id="e-ip" value="" placeholder="ip地址" class="textbox" style="padding:0px;" />
         </li>
         <li class="network_type">
          <span class="ttl">MAC</span>
          <input type="text" name="e-mac" id="e-mac" value="" placeholder="网络设备远程访问密码" class="textbox" style="padding:0px;" />
         </li>
         
         <br style="width:0px;height:0px;clear:both;" />
         
         
        </ul>
       </div>
      
       <!--bottom:operate->button-->
       <div class="btm_btn">
        <input type="button" value="确认" class="input_btn trueBtn"/>
        <input type="button" value="关闭" class="input_btn falseBtn"/>
       </div>
      </div>
      
      <script>
      $(function(){
    	  $(".network_type").hide();
     	  $("#e-network").change(function(){
     		  var ty =$(this).val();
     		  if(ty=='0')
     		  {
     			 $(".network_type").hide(); 
     		  }else
     		  {
     			 $(".network_type").show();
     		  }
     	  });
	       $(".trueBtn").unbind().bind("click",function(){
			 
	    	var that =this;
   		    var url="/admin/devlist/addData";
   		 	var dveid=$("#e-dveid").val();
		    var dvename=$("#e-dvename").val();
		    var first_type=$("#e-first_type").val();
		    var type=$("#e-type").val();
		    var brand=$("#e-brand").val();
		    var sn=$("#e-sn").val();
		    var model=$("#e-model").val();
		    var addr=$("#e-addr").val();
		    var price=$("#e-price").val();
		    var network=$("#e-network").val();
		    var price=$("#e-price").val();
		    var amount=$("#e-amount").val();
		    var unit=$("#e-unit").val();
		    var amount=$("#e-amount").val();
		    //var rpwd=$("#e-rpwd").val();
		    var mac=$("#e-mac").val();
		    var ip=$("#e-ip").val();
		    var rpwd=$("#e-rpwd").val();
		    if(dvename=="")
		    {
		    	ErrTiShi("资产名称不能够为空");return false;
		    }
		    var param={
				dveid:dveid,
	   		    dvename:dvename,
	   		    first_type:first_type,
	   		    type:type,
	   		    brand:brand,
	   		    sn:sn,
	   		    model:model,
	   		    addr:addr,
	   		    price:price,
	   		    network:network,
	   		    amount:amount,
	   		    unit:unit,
	   		    //rpwd:rpwd,
	   		    mac:mac,
	   		    ip:ip,
				sys_opt:'addData'//后台判断编辑操作
		    };
			 AjaxRequest(url,param,function(data){
  			   if(data.err==0)
  			   {
  				 
  				   var isContinut=0;
  				   cofirmsss_tishi(1,'操作成功,您是否继续添加？',function(id){
  					   isContinut=1;
  					   getCodes();
  					 $(".pop_bg").fadeIn();
  				   });
  				  if(isContinut==0)
  				  {
  					 	$(".pop_bg").fadeOut();
  				   	
  				   		myResearch();
  					   
  				  }
  				  
  			   }
  			   else
  			   {
  				   ErrTiShi(data.msg);
  			   }
  		   	});
			 
		  });
		   //弹出：取消或关闭按钮
		   $(".falseBtn").unbind().bind("click",function(){
		
			 $(".pop_bg").fadeOut();
		   });
		   

		   $(".firstTypeRS").change(function(){
		  	   
		  	   var url="/admin/devlist/selectTypeChange";
		  		    var id=$(this).val();
		  		   
		  		    var param={
		  				   id:id
		  				   
		  		    };
		  	   AjaxRequest(url,param,function(data){
		  		   if(data.err==0)
		  		   {
		  			   var html='<option value="">--选择--</option>';
		  			   $.each(data.data,function(i,v){
		  				 html +='<option value="'+v.id+'">'+v.dname+'</option>'
		  			   })
		  			   $(".secondTypeRS").html(html);
		  		   }
		  		   else
		  		   {
		  			   ErrTiShi("操作失败");
		  		   }
		  	   	});
		  	   
		   });
		   
		   
 $(".secondTypeRS").change(function(){
		  	   
	 getCodes();
 });
		   
		   
		  /** $("#autoDve").click(function(){
		  		
		  		     if(this.checked)
		  			 {
		  		    	$("#e-dveid").val("");
		  			    $("#e-dveid").attr("disabled", true);
		  			 }
		  		    else
		  			 {
		  		    
		  			   $("#e-dveid").attr("disabled", false);
		  			 }
		  	   });
		  	 */
		  	   
		  	   // $("#e-dveid").val("");
	  			//$("#e-dveid").attr("disabled", true);
		   
			$("#all").click(function(){   
		    	if(this.checked){   
		        	$(".checkBoxInput").attr("checked", true);  
		        	$(".checkBoxInput").prop("checked", true);  
		    	}else{   
					$(".checkBoxInput").attr("checked", false);
					$(".checkBoxInput").prop("checked", false);
		    	}   
		    	var se=getAllSelectItem();
		    	//console.log(se);
		 	}); 
			   
 	});
      function getCodes()
      {
    	   var url="/admin/devlist/generaCode";
		    var id=$("#e-type").val();
		   
		    var param={
				   id:id
				   
		    };
		   
	   AjaxRequest(url,param,function(data){
		   if(data.err==0)
		   {
			   
			   $("#e-dveid").val(data.data);
		   }
		   else
		   {
			   ErrTiShi("操作失败");
		   }
	   	});
	   
      }
      </script>